package Array;

public class Demo03 {
    public static void main(String[] args) {
        int[] arrys={1,2,3,4,5};
        //打印全部数组
        for (int i = 0; i < arrys.length; i++) {
            System.out.println(arrys[i]);
        }
        System.out.println("===========");
        int sum=0;
        for (int i = 0; i < arrys.length; i++) {
            sum+=arrys[i];
        }
        System.out.println("sum="+sum);
        //查找最大元素
        System.out.println("===========");
        int max = arrys[0];
        for (int i = 0; i < arrys.length; i++) {
            if (arrys[i]>max){
                max = arrys[i];
            }
            System.out.println(max);
        }
    }
}
